
<?php
if ($result == NULL) {
    ?>
    <h1 class="caption">Kết quả xổ số <span class="tinh"></span><span class="ngaythang"></span><span class="dayofweek"></span></h1>
    <div class="no-record">Chưa có kết quả xổ số</div>
    <?php
} else {

    $RegionID = $result['RegionID'];
    $ProvinceName = $result['ProvinceName'];
    $ResultID = "";
    $ResultDate = "";

    if ($RegionID === "B") {
        $ResultID = $result['ResultBID'];
        $ResultDate = $result['ResultBDate'];
        $G7_1 = $result['G7_1'];
        $G7_2 = $result['G7_2'];
        $G7_3 = $result['G7_3'];
        $G7_4 = $result['G7_4'];
        $G6_1 = $result['G6_1'];
        $G6_2 = $result['G6_2'];
        $G6_3 = $result['G6_3'];
        $G5_1 = $result['G5_1'];
        $G5_2 = $result['G5_2'];
        $G5_3 = $result['G5_3'];
        $G5_4 = $result['G5_4'];
        $G5_5 = $result['G5_5'];
        $G5_6 = $result['G5_6'];
        $G4_1 = $result['G4_1'];
        $G4_2 = $result['G4_2'];
        $G4_3 = $result['G4_3'];
        $G4_4 = $result['G4_4'];
        $G3_1 = $result['G3_1'];
        $G3_2 = $result['G3_2'];
        $G3_3 = $result['G3_3'];
        $G3_4 = $result['G3_4'];
        $G3_5 = $result['G3_5'];
        $G3_6 = $result['G3_6'];
        $G2_1 = $result['G2_1'];
        $G2_2 = $result['G2_2'];
        $G1 = $result['G1'];
        $GDB = $result['GDB'];
        ?>

        <h1 class="caption">Kết quả xổ số <span class="tinh"></span><span class="ngaythang"></span><span class="dayofweek"></span></h1>

        <div class="content" data-region="<?php echo $RegionID; ?>">
            <div data-thread-no="7" class="row">
                <span data-num-no="1"><?php echo $G7_1; ?></span><span data-num="2"><?php echo $G7_2; ?></span><span data-num="3"><?php echo $G7_3; ?></span>
                <span data-num-no="4"><?php echo $G7_4; ?></span>
            </div>
            <div data-thread-no="6" class="row">
                <span data-num-no="1"><?php echo $G6_1; ?></span><span data-num="2"><?php echo $G6_2; ?></span><span data-num="3"><?php echo $G6_3; ?></span>
            </div>
            <div data-thread-no="5" class="row">
                <span data-num-no="1"><?php echo $G5_1; ?></span><span data-num-no="2"><?php echo $G5_2; ?></span><span data-num-no="3"><?php echo $G5_3; ?></span>
                <span data-num-no="4"><?php echo $G5_4; ?></span><span data-num-no="5"><?php echo $G5_5; ?></span><span data-num-no="6"><?php echo $G5_6; ?></span>
            </div>
            <div data-thread-no="4" class="row">
                <span data-num-no="1"><?php echo $G4_1; ?></span><span data-num-no="2"><?php echo $G4_2; ?></span><span data-num-no="3"><?php echo $G4_3; ?></span>
                <span data-num-no="4"><?php echo $G4_4; ?></span>
            </div>
            <div data-thread-no="3" class="row">
                <span data-num-no="1"><?php echo $G3_1; ?></span><span data-num-no="2"><?php echo $G3_2; ?></span><span data-num-no="3"><?php echo $G3_3; ?></span>
                <span data-num-no="4"><?php echo $G3_4; ?></span><span data-num-no="5"><?php echo $G3_5; ?></span><span data-num-no="6"><?php echo $G3_6; ?></span>
            </div>
            <div data-thread-no="2" class="row">
                <span data-num-no="1"><?php echo $G2_1; ?></span><span data-num-no="2"><?php echo $G2_2; ?></span>
            </div>
            <div data-thread-no="1" class="row">
                <span data-num-no="1"><?php echo $G1; ?></span>
            </div>
            <div data-thread-no="ĐB" class="row">
                <span data-num-no="1"><?php echo $GDB; ?></span>
            </div>
        </div>

        <?php
    } else {
        $ResultID = ($RegionID === "N") ? $result['ResultNID'] : $result['ResultTID'];
        $ResultDate = ($RegionID === "N") ? $result['ResultNDate'] : $result['ResultTDate'];
        $G8 = $result['G8'];
        $G7 = $result['G7'];
        $G6_1 = $result['G6_1'];
        $G6_2 = $result['G6_2'];
        $G6_3 = $result['G6_3'];
        $G5 = $result['G5'];
        $G4_1 = $result['G4_1'];
        $G4_2 = $result['G4_2'];
        $G4_3 = $result['G4_3'];
        $G4_4 = $result['G4_4'];
        $G4_5 = $result['G4_5'];
        $G4_6 = $result['G4_6'];
        $G4_7 = $result['G4_7'];
        $G3_1 = $result['G3_1'];
        $G3_2 = $result['G3_2'];
        $G2 = $result['G2'];
        $G1 = $result['G1'];
        $GDB = $result['GDB'];
        ?>

        <h1 class="caption">Kết quả xổ số <span class="tinh"></span><span class="ngaythang"></span><span class="dayofweek"></span></h1>

        <div class="content" data-region="<?php echo $RegionID; ?>">
            <div data-thread-no="8" class="row">
                <span data-num-no="1"><?php echo $G8; ?></span>
            </div>
            <div data-thread-no="7" class="row">
                <span data-num-no="1"><?php echo $G7; ?></span>
            </div>
            <div data-thread-no="6" class="row">
                <span data-num-no="1"><?php echo $G6_1; ?></span><span data-num="2"><?php echo $G6_2; ?></span><span data-num="3"><?php echo $G6_3; ?></span>
            </div>
            <div data-thread-no="5" class="row">
                <span data-num-no="1"><?php echo $G5; ?></span>
            </div>
            <div data-thread-no="4" class="row">
                <span data-num-no="1"><?php echo $G4_1; ?></span><span data-num-no="2"><?php echo $G4_2; ?></span><span data-num-no="3"><?php echo $G4_3; ?></span>
                <span data-num-no="4"><?php echo $G4_4; ?></span><span data-num-no="5"><?php echo $G4_5; ?></span><span data-num-no="6"><?php echo $G4_6; ?></span>
                <span data-num-no="7"><?php echo $G4_7; ?></span>
            </div>
            <div data-thread-no="3" class="row">
                <span data-num-no="1"><?php echo $G3_1; ?></span><span data-num-no="2"><?php echo $G3_2; ?></span>
            </div>
            <div data-thread-no="2" class="row">
                <span data-num-no="1"><?php echo $G2; ?></span>
            </div>
            <div data-thread-no="1" class="row">
                <span data-num-no="1"><?php echo $G1; ?></span>
            </div>
            <div data-thread-no="ĐB" class="row">
                <span data-num-no="1"><?php echo $GDB; ?></span>
            </div>
        </div>

        <?php
    }
}
?>